<script setup lang="ts">
import { useRouter } from 'vue-router'

/*
  路由的跳转
    import {useRouter} from 'vue-router'
    const router=useRouter()   router===this.$router
    router.push('/path地址')

  vue3路由传值
    query
      传：
       import {useRouter} from 'vue-router'
       const router=useRouter()   router===this.$router
       router.push('/path地址?参数名=值')
      收：
       import {useRoute} from 'vue-router'
       const route=useRoute()  route===this.$route
       route.query.参数名

    params:vue3不支持 建议使用pinia
    动态路由匹配
*/
const router = useRouter()
const btnClick = () => {
  router.push('/playtest?id=123')
}
</script>

<template>
  <div class="play-page">
    <router-link to="/playtest">跳转到test</router-link>
    <button @click="btnClick">跳转到test</button>
    <button @click="$router.push('/playtest')">跳转到test</button>
  </div>
</template>

<style lang="scss" scoped></style>
